//
//  DCChangePhoneNumView.m
//  JiuyaoDriver
//
//  Created by 大橙子 on 2018/11/29.
//  Copyright © 2018 Tomous. All rights reserved.
//

#import "DCChangePhoneNumView.h"
@interface DCChangePhoneNumView()<UITextFieldDelegate>
@property (nonatomic,strong) UILabel *phoneLabel;
@property (nonatomic,strong) UILabel *codeLabel;

@end
@implementation DCChangePhoneNumView
-(instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        
        [self setUpUI];
    }
    return self;
}
-(void)setUpUI
{
    self.phoneLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, 70*WIDTHSCALE6, 40)];
    self.phoneLabel.backgroundColor = [UIColor whiteColor];
    self.phoneLabel.textColor = [UIColor lightGrayColor];
    self.phoneLabel.font = FONT(15);
    self.phoneLabel.text = @"手机号 ：";
    self.phoneLabel.textAlignment = NSTextAlignmentCenter;
    [self addSubview:self.phoneLabel];
    
    self.phoneTextField = [[UITextField alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.phoneLabel.frame)+3, self.phoneLabel.y, ScreenWidth - 30 - self.phoneLabel.width, self.phoneLabel.height)];
    self.phoneTextField.backgroundColor = [UIColor whiteColor];
    self.phoneTextField.textColor = [UIColor lightGrayColor];
    self.phoneTextField.font = FONT(15);
    self.phoneTextField.textAlignment = NSTextAlignmentLeft;
    self.phoneTextField.keyboardType = UIKeyboardTypeNumberPad;
    self.phoneTextField.delegate = self;
    [self addSubview:self.phoneTextField];
    
    self.codeLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.phoneLabel.x, CGRectGetMaxY(self.phoneLabel.frame) + 10, self.phoneLabel.width, self.phoneLabel.height)];
    self.codeLabel.text = @"验证码 ：";
    self.codeLabel.backgroundColor = [UIColor whiteColor];
    self.codeLabel.textColor = [UIColor lightGrayColor];
    self.codeLabel.textAlignment = NSTextAlignmentCenter;
    self.codeLabel.font = FONT(15);
    [self addSubview:self.codeLabel];
    
    self.codeTextField = [[UITextField alloc]initWithFrame:CGRectMake(self.phoneTextField.x, self.codeLabel.y, ScreenWidth - 20 - self.codeLabel.width - 150*WIDTHSCALE6, self.codeLabel.height)];
    self.codeTextField.backgroundColor = [UIColor whiteColor];
    self.codeTextField.placeholder = @" 请输入手机验证码";
    self.codeTextField.font = FONT(15);
    self.codeTextField.keyboardType = UIKeyboardTypeNumberPad;
    [self addSubview:self.codeTextField];
    
    self.getCodeBtn = [[UIButton alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.codeTextField.frame), self.codeTextField.y, 100*WIDTHSCALE6, self.codeTextField.height)];
    [self.getCodeBtn setTitleColor:BlueColor forState:UIControlStateNormal];
    [self.getCodeBtn setTitle:@"获取验证码" forState:UIControlStateNormal];
    [self.getCodeBtn addTarget:self action:@selector(getCodeBtnDidClick) forControlEvents:UIControlEventTouchUpInside];
    self.getCodeBtn.backgroundColor = [UIColor whiteColor];
    self.getCodeBtn.titleLabel.font = FONT(15);
    [self addSubview:self.getCodeBtn];
    
    UIView *line = [[UIView alloc]initWithFrame:CGRectMake(self.codeTextField.x, CGRectGetMaxY(self.codeTextField.frame)-5, self.codeTextField.width+self.getCodeBtn.width, 0.8)];
    line.backgroundColor = [UIColor lightGrayColor];
    [self addSubview:line];
    
    UIView *line1 = [[UIView alloc]initWithFrame:CGRectMake(self.phoneTextField.x, CGRectGetMaxY(self.phoneTextField.frame)-5, self.codeTextField.width+self.getCodeBtn.width, 0.8)];
    line1.backgroundColor = [UIColor lightGrayColor];
    [self addSubview:line1];
}
-(void)getCodeBtnDidClick
{
    if (_block) {
        _block();
    }
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
